//
//  EMRepayBottomItemView.m
//  EasyMoney
//
//  Created by zh on 2020/1/11.
//  Copyright © 2020 zh. All rights reserved.
//

#import "EMRepayBottomItemView.h"

@interface EMRepayBottomItemView ()

@property (nonatomic, strong) UILabel *titleLabel;

@end

@implementation EMRepayBottomItemView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    self.backgroundColor = ColorFromRGB(0xf8f8f8);

    UIImageView *joinImageView = [[UIImageView alloc]init];
    joinImageView.layer.cornerRadius = 22;
    UIImage *oriImage = [UIImage gradientImageSize:CGSizeMake(SCREEN_WIDTH-120, 44) colors:@[[UIColor colorwithHexString:@"#36B2FF"],[UIColor colorwithHexString:@"#2F5AFF"]] startPoint:CGPointMake(0, 22) endPoint:CGPointMake(SCREEN_WIDTH-120, 22)];
    UIImage *resultImage = [oriImage roundImageWithCornerRadius:22];
    joinImageView.image = resultImage;
    [self addSubview:joinImageView];
    [joinImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(60);
        make.right.mas_equalTo(-60);
        make.height.mas_equalTo(44);
        make.top.equalTo(self);
    }];

    self.titleLabel = [[UILabel alloc]init];
    self.titleLabel.textColor = ColorFromRGB(0xffffff);
    self.titleLabel.font = FONT_PINGFANG_MEDIUM_(18);
    [joinImageView addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(joinImageView);
    }];

    _contentBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self addSubview:_contentBtn];
    [_contentBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
}

- (void)setTitle:(NSString *)title{
    _title = title;

    self.titleLabel.text = title;
}


@end
